package com.hdu.dwh.vos;

import java.util.Set;

import org.springframework.beans.BeanUtils;

import com.hdu.dwh.pojos.cube_pojos.Cuboid;
import com.hdu.dwh.pojos.cube_pojos.CuboidDimension;
import com.hdu.dwh.pojos.cube_pojos.CubeMetric;

import lombok.Data;

@Data
public class CubeVo {
    private Integer id;

    private String name;

    private String description;

    private Integer modelId;

    private String operator;

    private String createdBy;

    Set<CuboidVo> cuboids;

    Set<CubeMetric> metrics;

    public void setCuboids(Set<Cuboid> _cuboids) {
        Set<CuboidVo> cuboidVos = _cuboids.stream().map(cuboid -> {
            CuboidVo cuboidVo = new CuboidVo();
            BeanUtils.copyProperties(cuboid, cuboidVo);
            cuboidVo.setDimensions(cuboid.getDimensions());
            cuboidVo.setNextLevelCuboids(cuboid.getNextLevelCuboids());
            cuboidVo.setPreLevelCuboids(cuboid.getPreLevelCuboids());
            return cuboidVo;
        }).collect(java.util.stream.Collectors.toSet());;
        
        this.cuboids = cuboidVos;
    }

}
